<template>
  <div>
    <slot name="title" :title="title">
      <h4 class="company-section-title">{{ title }}</h4>
    </slot>

    <table class="table table-bordered">
      <thead>
        <tr class="company-info-bg">
          <th v-for="(c, index) in columns" :key="index">{{ c.label }}</th>
        </tr>
      </thead>
      <tbody>
        <tr v-if="!data.length">
          <td :colspan="columns.length">
            <div class="text-muted text-center p-3">
              <span>暂无{{ title }}</span>
            </div>
          </td>
        </tr>
        <tr v-for="(item, index) in data" :key="index">
          <td v-for="(c, index) in columns" :key="index">
            <span v-if="c.type === 'index'">{{ index + 1 }}</span>
            <span v-else>{{ item[c.prop || ''] }}</span>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    title: String,
    columns: {
      type: Array,
      default: () => [],
    },
    data: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {},
}
</script>

<style lang="scss" scoped></style>
